<template>
    <div>
        <!-- <h3>当前最新的count值为：{{count}}</h3> -->
        <h3>{{showNum}}</h3>
        <button @click="btnHandle1()">-1</button>
        <button @click="btnHandle2()">-N</button>
        <button @click="btnHandle3()">-N异步</button>
    </div>
</template>
<script>
// 导入mapState函数
import {mapState, mapMutations, mapActions, mapGetters} from "vuex";
export default {
    name:"SubAction",
    data(){
        return{

        }
    },
    computed:{
        // ...mapState(){
        //     count,
        // }
        ...mapState(['count']),
        ...mapGetters(['showNum'])
    },
    methods:{
        ...mapMutations(['sub','subN']),
        btnHandle1(){
            this.sub();
        },
        btnHandle2(){
            this.subN(3);
        },
        ...mapActions(['sun1Sync']),
        btnHandle3(){
            this.sun1Sync()
        }
    }
    
}
</script>